﻿<%@ Page Title="Màu lễ cưới" Language="C#" MasterPageFile="~/Templates/Blank.Master" AutoEventWireup="true" CodeBehind="ColorList.aspx.cs" Inherits="VIT.Wedding.Admin.ColorList" %>
<%@ Register Assembly="VIT.Web.Controls" Namespace="VIT.Web.Controls" TagPrefix="VIT" %>
<%@ Register Assembly="VIT.Pre" Namespace="VIT.Pre" TagPrefix="cc" %>

<asp:Content ID="HeadContent" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="<%=URLRoot %>Admin/Includes/VIT.js"></script>
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
    <form id="aspnetForm" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
        <div>
            <table class="nostyle" style="float:left; width:70%">
                <tr>
                    <td>Ngôn ngữ:
                        <asp:DropDownList ID="ddlLang" runat="server" autopostback="true"  onselectedindexchanged="ddlLang_SelectedIndexChanged"></asp:DropDownList>
                    </td>
                </tr>
            </table>
            <div class="toolbar">
                <VIT:Submit ID="Insert" runat="server" Function="Product_Insert" ToolTip="Thêm" CssClass="icon-32-add" BorderStyle="None" OnClick="Insert_Click"/>
                <VIT:Submit ID="Delete" runat="server" Function="Product_Delete" ToolTip="Xóa" CssClass="icon-32-delete" BorderStyle="None" OnClick="Delete_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn bài viết để xóa.')  && confirm('Xóa bài viết được chọn');"/>
            </div>
        </div>
        <div class="clr"></div>
        <asp:UpdatePanel runat="server" ID="udpColorWedding">
            <ContentTemplate>
                <cc:ListView runat="server" ID="lsvColorWedding" DataKeyNames="Id"
                    OnItemEditing="lsvColorWedding_ItemEditing"
                    OnItemInserting="lsvColorWedding_ItemInserting"
                    OnItemUpdating="lsvColorWedding_ItemUpdating"
                    OnItemCanceling="lsvColorWedding_ItemCanceling">
                    <EmptyDataTemplate><strong>Không có dữ liệu</strong></EmptyDataTemplate>
                    <LayoutTemplate>
                        <table width="100%">
                            <thead>
	                            <tr>
                                    <th width="5%">#</th>
		                            <th width="5%">
			                            <input type="checkbox" name="toggle" id="toggle" onclick="checkAll('toggle', 'itemCheckbox')"/>
	                                </th>
		                            <th width="15%">
                                        <VIT:LinkSubmit ID="lnkName" runat="server" Param="Name" ViewStateMode="Disabled" OnClick="sortedChange_OnClick">Tên màu</VIT:LinkSubmit>
                                    </th>
                                    <th width="10%">Mã màu</th>
                                    <th width="20%">Hình đại diện</th>
                                    <th width="30%">
                                        <VIT:LinkSubmit ID="lnkDescription" runat="server" Param="Description" ViewStateMode="Disabled" OnClick="sortedChange_OnClick">Mô tả</VIT:LinkSubmit>
                                    </th>
                                    <th width="10%">ID</th>
		                            <th width="5%">Sửa</th>
	                            </tr>			
                            </thead>
                            <tbody>
                                <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
                            </tbody>
                        </table>
                        <asp:DataPager ID="DataPager1" runat="server" PagedControlID="lsvColorWedding" PageSize="10">
                            <Fields>
                                <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" FirstPageText="Trang đầu" PreviousPageText="<<" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" LastPageText="Trang cuối" NextPageText=">>" />
                            </Fields>
                        </asp:DataPager>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr class="row<%#Container.DataItemIndex%2 %>">
                            <td align="center"><%#Container.DataItemIndex%></td>
                            <td align="center">
		                        <input type="checkbox" name="itemCheckbox" value="<%#Eval("Id")%>" />
                            </td>
                            <td align="left"><%#Eval("Name")%></td>
                            <td align="left" style="background-color: #<%# Convert.ToInt64(Eval("Value")).ToString("X6")%>"></td>
                            <td align="left"><img alt="" src='<%# VIT.Library.Web.URL.baseUrl + "Uploads/Images/Colors/Thumbs/" + Convert.ToString(Eval("ImagePath"))%>' /></td>
                            <td align="left"><%#Eval("Description")%></td>
                            <td align="center"><%#Eval("Id")%></td>
                            <td align="center"><asp:LinkButton runat="server" ID="lbtEdit" CommandName="Edit" CommandArgument='<%#Eval("Id")%>' CausesValidation="False">Sửa</asp:LinkButton></td>
                        </tr>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <tr class="row<%#Container.DataItemIndex%2 %>">
                            <td align="center"><%#Container.DataItemIndex%></td>
                            <td />
                            <td><asp:TextBox runat="server" ID="txtName" EnableViewState="false" Text='<%# Eval("Name") %>'></asp:TextBox></td>
                            <td><asp:TextBox runat="server" ID="txtColor" Text='<%# Convert.ToInt64(Eval("Value")).ToString("X6") %>'></asp:TextBox></td>
                            <td><asp:FileUpload runat="server" ID="fupColor" /></td>
                            <td><asp:TextBox runat="server" ID="txtDescription" EnableViewState="false" Text='<%# Eval("Description") %>'></asp:TextBox></td>
                            <td colspan="2" align="center">
                                <asp:ImageButton runat="server" ID="ibtApply" ToolTip="Lưu lại" CssClass="icon-32-apply" CommandName="Update" EnableViewState="false" Value=""></asp:ImageButton>
                                <asp:ImageButton runat="server" ID="ibtCancel" ToolTip="Hủy bỏ" CssClass="icon-32-cancel" CommandName="Cancel" EnableViewState="false" Value=""></asp:ImageButton>
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <tr class="row0">
                            <td align="center"></td>
                            <td />
                            <td><asp:TextBox runat="server" ID="txtName"></asp:TextBox></td>
                            <td><asp:TextBox runat="server" ID="txtColor"></asp:TextBox></td>
                            <td><asp:FileUpload runat="server" ID="fupColor" /></td>
                            <td><asp:TextBox runat="server" ID="txtDescription"></asp:TextBox></td>
                            <td colspan="2">
                                <asp:ImageButton runat="server" ID="ibtApply" ToolTip="Lưu lại" CssClass="icon-32-apply" CommandName="Insert" EnableViewState="false" Value=""></asp:ImageButton>
                                <asp:ImageButton runat="server" ID="ibtCancel" ToolTip="Hủy bỏ" CssClass="icon-32-cancel" CommandName="Cancel" EnableViewState="false" Value=""></asp:ImageButton>
                            </td>
                        </tr>
                    </InsertItemTemplate>
                </cc:ListView>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Insert" EventName="Click" />
                <asp:PostBackTrigger ControlID="lsvColorWedding" />
            </Triggers>
        </asp:UpdatePanel>
    </form>
    <script type="text/javascript">
        $("#aside ul li#ColorList").addClass("submenu-active");
    </script>
</asp:Content>